package com.itdachang.design.structural.flyweight;

import lombok.AllArgsConstructor;
import lombok.ToString;

/**
 * 具体享元类
 * @author gcq
 * @Create 2022-02-13
 */
@AllArgsConstructor
@ToString
public class BeautifulWaitress extends AbstractWaitressFlyweight {
    /**
     * 服务Id
     */
    String id;
    /**
     * 服务姓名
     */
    String name;
    /**
     * 服务年龄
     */
    int age;
    // 以上都是不变的

    @Override
    void service() {
        System.out.println("工号:" + id + ":" + name + " " + age + " 正在为你服务...");
        // 改变外部状态
        this.canService = false;
    }

    @Override
    void end() {
        System.out.println("工号:" + id + ":" + name + " " + age + "服务结束...记得给五星好评");
        this.canService = true;
    }
}